import { defineStore } from 'pinia';
import api from '@/common/api/api.js'

export const useMainStore  = defineStore('main', {
	state: () => {
		return {
			userInfo: uni.getStorageSync('USER_INFO') || {},
		}
	},
	
	actions: {
		handleGetUserInfo(){
			api.getUserInfo().then(res=>{
				this.userInfo = res.data.data  //存到pinia
				uni.setStorageSync('USER_INFO', res.data.data);  //存到本地存储
			})
		}
	},
	
	getters:{
		
	},
});